<%@ page language="java" contentType="text/html; charset=UTF-8" 
import="org.windblog.core.*,org.windblog.core.entity.*,java.util.Date" pageEncoding="UTF-8"%>
<%@page import="org.windblog.api.template.TemplateService"%>  

<jsp:include page="header.jsp"></jsp:include>
	<div id="content" class="narrowcolumn">

		<%
		if (TemplateService.havePosts()){
 	   /* If this is a category archive */ if (WBQuery.isCategory()) { %>
		<h2 class="pagetitle">Archive for the &#8216;<%=TemplateService.singleCatTitle() %>&#8217; Category</h2>
 	  <% /* If this is a tag archive */ } else if (WBQuery.isMonth()) { %>
		<h2 class="pagetitle">Archive for <%= WBQuery.getTime("MMMMM , yyyy") %></h2>
 	  <% /* If this is a yearly archive */ } else if (WBQuery.isYear()) { %>
		<h2 class="pagetitle">Archive for <%= WBQuery.getTime("yyyy") %></h2>
<%
 	  }
 	  while (TemplateService.havePosts()) 
 		{
 			TemplateService.thePost();
	%>
	<div <%=TemplateService.postClass()%> id="post-<%=TemplateService.theID() %>">
	<h2><a href="<%=TemplateService.thePermalink() %>" rel="bookmark" title="Permanent Link to <%=TemplateService.theTitle() %>"><%=TemplateService.theTitle() %></a></h2>
	<small><%=TemplateService.theTime()%> <!-- by <%=TemplateService.theAuthor() %> --></small>
	<div class="entry">
					<%=TemplateService.theContent() %>
	</div>
	</div>
	<%
	}
 }else {

		if ( WBQuery.isCategory() ) { // If this is a category archive
			out.println("<h2 class='center'>Sorry, but there aren't any posts in the "+ TemplateService.singleCatTitle()+" category yet.</h2>");
		} else if ( WBQuery.isMonth() || WBQuery.isYear() ) { // If this is a date archive
			out.println("<h2>Sorry, but there aren't any posts with this date.</h2>");
		} else {
			out.println("<h2 class='center'>No posts found.</h2>");
		}
	}
%>

	</div>

<jsp:include page="sidebar.jsp"></jsp:include>
<jsp:include page="footer.jsp"></jsp:include>
